package com.techthinker.dreamBuilder.Activitites;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;

import com.techthinker.dreamBuilder.R;
import com.techthinker.dreamBuilder.Utils.TouchedAnimation;

public class RootViewActivity extends Activity implements OnClickListener {
	/**
	 * root screen of the application
	 * 
	 * @author Techthinker
	 */

	/**
	 * @param all
	 *            the ImageButtions in the UI
	 */
	private ImageButton learn, test, notebook, history, dictionary, setting,
			help;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//fullscreen mode
		int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
		Window myWindow = this.getWindow();
		myWindow.setFlags(flag, flag);
		setContentView(R.layout.rootview);

		// find the view control
		learn = (ImageButton) findViewById(R.id.ImageButton_learn);
		learn.setOnClickListener(this);
		learn.setOnTouchListener(TouchedAnimation.TouchDark);
		test = (ImageButton) findViewById(R.id.ImageButton_test);
		test.setOnClickListener(this);
		test.setOnTouchListener(TouchedAnimation.TouchDark);
		notebook = (ImageButton) findViewById(R.id.ImageButton_notebook);
		notebook.setOnClickListener(this);
		notebook.setOnTouchListener(TouchedAnimation.TouchDark);
		history = (ImageButton) findViewById(R.id.ImageButton_history);
		history.setOnClickListener(this);
		history.setOnTouchListener(TouchedAnimation.TouchDark);
		dictionary = (ImageButton) findViewById(R.id.ImageButton_dictionary);
		dictionary.setOnClickListener(this);
		dictionary.setOnTouchListener(TouchedAnimation.TouchDark);
		setting = (ImageButton) findViewById(R.id.ImageButton_setting);
		setting.setOnClickListener(this);
		setting.setOnTouchListener(TouchedAnimation.TouchDark);
		help = (ImageButton) findViewById(R.id.ImageButton_help);
		help.setOnClickListener(this);
		help.setOnTouchListener(TouchedAnimation.TouchDark);
	}

	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.ImageButton_learn:
			Intent toLearn = new Intent();
			toLearn.setClass(this, LearnActivity.class);
			startActivity(toLearn);
			break;
		case R.id.ImageButton_test:
			Intent toTest = new Intent();
			toTest.setClass(this, TestActivity.class);
			startActivity(toTest);
			break;
		case R.id.ImageButton_notebook:
			Intent toNotebook = new Intent();
			toNotebook.setClass(this, NotebookActivity.class);
			startActivity(toNotebook);
			break;
		case R.id.ImageButton_history:
			Intent toHistory = new Intent();
			toHistory.setClass(this, HistoryActivity.class);
			startActivity(toHistory);
			break;
		case R.id.ImageButton_dictionary:
			Intent toDictionary = new Intent();
			toDictionary.setClass(this, DictionaryActivity.class);
			startActivity(toDictionary);
			break;
		case R.id.ImageButton_setting:
			Intent toSetting = new Intent();
			toSetting.setClass(this, SettingActivity.class);
			startActivity(toSetting);
			break;
		case R.id.ImageButton_help:
			Intent toHelp = new Intent();
			toHelp.setClass(this, HelpActivity.class);
			startActivity(toHelp);
			break;
		}
	}
}
